﻿using CentralFoveaLib.Brain;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestConsole
{
    class Program
    {
        /// <summary>
        /// 根据图片，分成不同的类型
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Test();
           var resu= BayesTheorem.Execute(0.4,0.5,0.6);
           var resu2 = resu * 0.4;
            //File
            String basePath = AppDomain.CurrentDomain.BaseDirectory;
            if (!Directory.Exists(basePath + "Images/")) { Directory.CreateDirectory(basePath + "Images/"); }
            if (!Directory.Exists(basePath + "Temp/")) { Directory.CreateDirectory(basePath + "Temp/"); }
            if (!Directory.Exists(basePath + "Cache/")) { Directory.CreateDirectory(basePath + "Cache/"); }

            String[] srcFilesPath = Directory.GetFiles(basePath + "Images/");
            if (srcFilesPath != null && srcFilesPath.Length > 0)
            {
                String tempPath = Path.Combine(basePath, "Temp/");
                String outputFilePath = Path.Combine(basePath, "Cache/");
                var helper = new ImageHelper();
                helper.ReadAllImage(srcFilesPath, tempPath, outputFilePath);
            }
            else
            {
                Console.WriteLine("No Image file.");
               
            }
            Console.ReadKey();
        }

        static void Test()
        {
            double realCoord, imagCoord;
            double realTemp, imagTemp, realTemp2, arg;
            int iterations;
            for (imagCoord = -1.2; imagCoord <= 1.2; imagCoord += 0.05)
            {
                for (realCoord = -1.77; realCoord <= .6; realCoord += 0.03)
                {
                    iterations = 0;
                    realTemp = realCoord;
                    imagTemp = imagCoord;
                    arg = (realCoord * realCoord) + (imagCoord * imagCoord);
                    while ((arg < 4) && (iterations < 100))
                    {
                        realTemp2 = (realTemp * realTemp) - (imagTemp * imagTemp)
                                    + realCoord;
                        imagTemp = (2 * realTemp * imagTemp) + imagCoord;
                        realTemp = realTemp2;
                        arg = (realTemp * realTemp) + (imagTemp * imagTemp);
                        iterations += 1;
                    }
                    switch (iterations % 4)
                    {
                        case 0:
                            Console.Write(".");
                            break;
                        case 1:
                            Console.Write("o");
                            break;
                        case 2:
                            Console.Write("O");
                            break;
                        case 3:
                            Console.Write("@");
                            break;
                    }
                }
                Console.Write("\n");
            }
            Console.ReadKey();
        }
    }
}
